<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="utf-8">
  <title>MapVGL</title>
  <meta http-equiv="X-UA-Compatible" content="IE=Edge">
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
  <style>
    html,
    body {
      width: 100%;
      height: 100%;
      margin: 0;
      padding: 0;
    }
    #map_container {
      width: 100%;
      height: 100%;
      margin: 0;
    }
  </style>
  <script src="//api.map.baidu.com/api?v=1.0&type=webgl&ak=baiduKey"></script>
  <script src="//mapv.baidu.com/build/mapv.min.js"></script>
  <script src="../../js/common.js"></script>
  <script src="https://code.bdstatic.com/npm/mapvgl@1.0.0-beta.119/dist/mapvgl.min.js"></script>
</head>
<body>
<div id="map_container"></div>
<script>
  /* global BMapGL */

  /* global mapv */

  /* global mapvgl */

  /* global initMap */

  /* global purpleStyle */

  var map = initMap({
    tile: 56.8,
    heading: 0,
    center: [106.521831,29.571811],
    zoom: 13,
    style: purpleStyle
  });

  var view = new mapvgl.View({
    // effects: [new mapvgl.BloomEffect()],
    map: map
  });

  fetch('../../data/car.csv').then(rs => {
    return rs.text();
  }).then(csvstr => {
    var dataSet = mapv.csv.getDataSet(csvstr);
    var data = dataSet.get().slice(0, 15);

    var layer = new mapvgl.WallLayer({
      gradient: {
        0: 'rgba(204, 153, 255, 0.5)',
        1: 'rgba(0, 0, 204, 0.2)'
      },
      height: 1000
    });
    view.addLayer(layer);

    var layer2 = new mapvgl.WallTripLayer({
      trailLength: 8.0,
      step: 0.4,
      color: 'rgba(255, 0, 102, 0.5)',
      height: 1000
    });

    view.addLayer(layer);
    view.addLayer(layer2);

    layer.setData(data);
    layer2.setData(data);
  });
</script>
</body>
</html>
